import { mergeConfig } from 'vite';
import baseConfig from './vite.config.base';
// import configCompressPlugin from './plugin/compress';
// import configVisualizerPlugin from './plugin/visualizer';
// import configImageminPlugin from './plugin/imagemin';
import config from '../package.json';

export default mergeConfig(
  {
    base: `/${config.name}`,
    mode: 'production',
    // plugins: [configCompressPlugin('gzip'), configVisualizerPlugin(), configImageminPlugin()],
    build: {
      outDir: `${config.name}`,
      // rollupOptions: {
      //   output: {
      //     manualChunks: {
      //       arco: ['@garco-design/web-vue'],
      //       chart: ['echarts', 'vue-echarts'],
      //       vue: ['vue', 'vue-router', 'pinia', '@vueuse/core', 'vue-i18n'],
      //     },
      //   },
      // },
      chunkSizeWarningLimit: 2000,
    },
    output: {
      library: `${config.name}-[name]`,
      libraryTarget: 'umd',
      jsonpFunction: `webpackJsonp_${config.name}`,
    },
  },
  baseConfig
);
